<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>搜索框设计</title>
    <link rel="stylesheet" href="search.css">
</head>
<body>
<div class="search-overlay"></div>
<div class="scroll-cont">
    <div class="content">
        <div class="search">
            <div class="search_bg"></div>
            <div class="search_box">
                <form action="https://www.baidu.com/s" id="form">
                    <input type="text" name="wd" class="search_input" placeholder="Search" onkeydown="search()"/>
                </form>
                <div class="search_line"></div>
                <div class="search_close"></div>
            </div>
        </div>
    </div>
</div>
<!-- partial -->
<script src="search.js"></script>
<script>
    function search(event) {
        if (event.keyCode == 13 ) {
            document.getElementById('form').submit();
        }
    }
</script>
</body>
</html>